package com.maimao.goods.client.factory;

import com.maimao.core.enums.RespCode;
import com.maimao.core.model.resp.Result;
import com.maimao.goods.client.KillApplyClient;
import com.maimao.goods.client.OrderClient;
import com.maimao.model.kill.input.ActivityScheduleIdInput;
import com.maimao.model.order.input.CommentStatusUpdateInput;
import feign.hystrix.FallbackFactory;
import groovy.lang.Tuple2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author MaoLin Wang
 * @date 2020/11/30 10:03 下午
 */
@Component
@Slf4j
public class KillApplyFallBackFactory implements FallbackFactory<KillApplyClient> {

    @Override
    public KillApplyClient create(Throwable cause) {
        String errorMsg = cause.getMessage() == null ? "" : cause.getMessage();

        return new KillApplyClient() {


            @Override
            public Result<List<Long>> querySkuIdsByAcSch(ActivityScheduleIdInput input) {
                log.error("调用[KillApplyClient-querySkuIdsByAcSch({})]出错 :{}", input, errorMsg);
                return Result.fail(RespCode.FAIL, errorMsg);
            }


        };
    }
}
